<%@page import="cn.jussi.mydbutils.MyDBUtils"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="cn.jussi.dao.BaseDao"%>
<%@page import="cn.jussi.model.User"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>

	<%
		BaseDao baseDao = new BaseDao();
			User user = new User();
			
			/* String sql = "insert into users values(?,?,?,?,?)";
			user.setUserName("FHL");
			user.setPassword("123456");
			user.setPhoneNum("0796");
			user.setAddress("南昌");
			user.setRegDate(new java.util.Date());	
			int count = dao.IUD(sql, 
						user.getUserName(), 
						user.getPassword(), 
						user.getPhoneNum(), 
						user.getAddress(), 
						new java.sql.Date(user.getRegDate().getTime())); */
			
			/* String sql = "update users set username=? where id=?";
			int count = dao.IUD(sql, "FHL", 8); */
			
			/* String sql = "delete users where id=?";
			int count = dao.IUD(sql, 8); */
			
			/* String sql = "select username userName, password password from users where id=?";
			user = dao.getOneData(User.class, sql, 1); */
			
			/* String sql = "select username userName, password password from users";
			List<User> list = new ArrayList<>();
			list = dao.getListData(User.class, sql);
			for(User tuser: list){
		out.println(tuser);
			}  */
			
			/* String sql = "select count(*) from users";
			int count = (int)dao.getOneColumn(sql);
			out.println(count); */
			
			/* String sql = "insert into users values(?,?,?,?,?)";
			user.setUserName("FHL");
			user.setPassword("123456");
			user.setPhoneNum("0796");
			user.setAddress("南昌");
			user.setRegDate(new java.util.Date());	
			int id = dao.insertReturnAutoColumn(sql, 
						user.getUserName(), 
						user.getPassword(), 
						user.getPhoneNum(), 
						user.getAddress(), 
						new java.sql.Date(user.getRegDate().getTime()));
			out.println(id); */
			
			Connection conn = MyDBUtils.getConnection();
			//设置事务隔离级别
			//conn.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
			//查看事务隔离级别
			out.println(conn.getTransactionIsolation());
			conn.setAutoCommit(false);
			String sql = "update users set username=? where id=?";
			baseDao.IUD(conn, sql, "路飞", 3);
			out.println("事务提交，暂停！");
			conn.commit();
	%>

</body>
</html>